<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

// 注册路由到News控制器的read操作
Route::put('user/update/:id', 'user/update');

//获取配置
Route::get('cos_config', 'Config/cos_config');

// 需要认证的路由组
Route::group(function() {
    // 获取菜单
    Route::get('menus', 'Menu/getMenus');
    // 其他需要权限控制的接口...
})->middleware(\app\middleware\PermissionMiddleware::class);


// 角色管理
Route::get('roles/export', 'Role/export');//精确路由放前面
Route::get('roles', 'Role/index');
Route::post('roles/create', 'Role/create');
Route::put('roles/update/:id', 'Role/update');
Route::delete('roles/delete/:id', 'Role/delete');

//登录
Route::post('login/login', 'Login/login');


// 账号管理
Route::get('users/export', 'User/export');//精确路由放前面
Route::get('users', 'User/index');
Route::post('users/create', 'User/create');
Route::put('users/update/:id', 'User/edit');
Route::delete('users/delete/:id', 'User/delete');


Route::get('admin/menus', 'Menu/getMenuList');

//轮播图
Route::group('banner', function(){
    Route::get('list', 'Banner/list');      // 列表
    Route::post('create', 'Banner/create');       // 新增
    Route::put('update/:id', 'Banner/update');     // 修改
    Route::delete('delete/:id', 'Banner/delete');       // 删除
    Route::post('import', 'Banner/import'); // 导入
    Route::get('export', 'Banner/export');  // 导出
});

//广告图
Route::group('advertisement', function(){
    Route::get('list', 'Advert/list');      // 列表
    Route::post('create', 'Advert/create');       // 新增
    Route::put('update/:id', 'Advert/update');     // 修改
    Route::delete('delete/:id', 'Advert/delete');       // 删除
    Route::post('import', 'Advert/import'); // 导入
    Route::get('export', 'Advert/export');  // 导出
});

//VIP
Route::group('vip', function(){
    Route::get('list', 'Vip/list');      // 列表
    Route::post('create', 'Vip/create');       // 新增
    Route::put('update/:id', 'Vip/update');     // 修改
    Route::delete('delete/:id', 'Vip/delete');       // 删除
    Route::post('import', 'Vip/import'); // 导入
    Route::get('export', 'Vip/export');  // 导出
});

//活动  activity
Route::group('activity', function () {
    Route::get('list', 'app\controller\Activity@list');
    Route::post('create', 'app\controller\Activity@create');
    Route::put('update/:id', 'app\controller\Activity@update');
    Route::delete('delete/:id', 'app\controller\Activity@delete');
    Route::get('export', 'app\controller\Activity@export');
    Route::post('import', 'app\controller\Activity@import');
});

// Search
Route::group('search', function () {
    Route::get('list', 'Search/list');
    Route::post('create', 'Search/create');
    Route::get('export', 'Search/export');
});


//官网  轮播图
Route::group('carousel', function () {
    Route::get('list', 'CarouselController/list');
    Route::post('create', 'CarouselController/create');
    Route::put('update/:id', 'CarouselController/update');
    Route::delete('delete/:id', 'CarouselController/delete');
    Route::get('export', 'CarouselController/export');
    Route::post('import', 'CarouselController/import');
    // 更新展示状态
    Route::post('updateDisplayStatus', 'CarouselController/updateDisplayStatus');
});

//官网  广告图
Route::group('webadvertisement', function () {
    Route::get('list', 'WebAdvertisement/list');
    Route::post('create', 'WebAdvertisement/create');
    Route::put('update/:id', 'WebAdvertisement/update');
    Route::delete('delete/:id', 'WebAdvertisement/delete');
    Route::get('export', 'WebAdvertisement/export');
    Route::post('import', 'WebAdvertisement/import');
});


//官网  信息管理
Route::group('webmanagement', function () {
    Route::get('list', 'WebManagement/list');
    Route::post('create', 'WebManagement/create');
    Route::put('update/:id', 'WebManagement/update');
    Route::delete('delete/:id', 'WebManagement/delete');
    Route::get('export', 'WebManagement/export');
    Route::post('import', 'WebManagement/import');
});


//系统  系统消息
Route::group('systemmessage', function () {
    Route::get('list', 'SystemMessage/list');
    Route::post('create', 'SystemMessage/create');
    Route::put('update/:id', 'SystemMessage/update');
    Route::delete('delete/:id', 'SystemMessage/delete');
    Route::get('export', 'SystemMessage/export');
    Route::post('import', 'SystemMessage/import');

    // 消息 已读 未读
    Route::get('unread/:userPhone', 'SystemMessage/unreadMessages');
    Route::get('read/:userPhone', 'SystemMessage/readMessages');
    Route::post('mark-read/:userPhone/:messageId', 'SystemMessage/markAsRead');
});


// 系统---问题反馈
Route::group('feedback', function () {
    Route::get('list', 'Feedback/list');
    Route::get('info', 'Feedback/info');
    Route::get('export', 'Feedback/export');
    Route::put('update/:id', 'Feedback/update');
});

// 系统---验证码
Route::group('verificationcode', function () {
    Route::get('list', 'VerificationCode/list');
    Route::get('export', 'VerificationCode/export');
});

// 系统---登录背景
Route::group('background', function () {
    Route::get('list', 'Background/list');
    Route::post('create', 'Background/create');
    Route::put('update/:id', 'Background/update');
    Route::delete('delete/:id', 'Background/delete');
    Route::get('export', 'Background/export');
});

//订单---订单列表
Route::group('order', function () {
    Route::get('list', 'Order/list');
    Route::get('export', 'Order/export');
    Route::post('refund', 'Order/refund');
});

//用户---用户列表
Route::group('member/users', function () {
    Route::get('index', 'MemberUsers/index');
    Route::get('export', 'MemberUsers/export');
    Route::post('freeze', 'MemberUsers/freeze');
    Route::get('detail/:user_id', 'MemberUsers/detail');
    Route::get('gameList', 'MemberUsers/gameList');
    Route::post('update', 'MemberUsers/update');
    Route::delete('deleteGame', 'MemberUsers/deleteGame');
    Route::post('restoreUserStatus', 'MemberUsers/restoreUserStatus');
});


//产品---游戏类型
Route::group('gametype', function () {
    Route::get('list', 'GameTypes/list');
    Route::post('create', 'GameTypes/create');
    Route::get('detail/:id', 'GameTypes/detail');
    Route::put('update/:id', 'GameTypes/update');
    Route::delete('delete/:id', 'GameTypes/delete');
    Route::post('import', 'GameTypes/import');
    Route::get('export', 'GameTypes/export');
});

//产品---页签分类
Route::group('product/tags', function () {
    Route::get('list', 'ProductTags/list');
    Route::post('create', 'ProductTags/create');
    Route::get('detail/:id', 'ProductTags/detail');
    Route::put('update/:id', 'ProductTags/update');
    Route::delete('delete/:id', 'ProductTags/delete');
    Route::post('import', 'ProductTags/import');
    Route::get('export', 'ProductTags/export');
});

//产品---账号管理
Route::group('product/account', function () {
    Route::get('list', 'ProductAccount/list');
    Route::post('create', 'ProductAccount/create');
    Route::get('detail/:id', 'ProductAccount/detail');
    Route::put('update/:id', 'ProductAccount/update');
    Route::delete('delete/:id', 'ProductAccount/delete');
    Route::post('import', 'ProductAccount/import');
    Route::get('export', 'ProductAccount/export');

    Route::get('gamelist', 'ProductAccount/gamelist');
});


//产品---产品特征
Route::group('product/feature', function () {
    Route::get('list', 'ProductFeature/list');
    Route::post('create', 'ProductFeature/create');
    Route::get('detail/:id', 'ProductFeature/detail');
    Route::put('update/:id', 'ProductFeature/update');
    Route::delete('delete/:id', 'ProductFeature/delete');
    Route::post('import', 'ProductFeature/import');
    Route::get('export', 'ProductFeature/export');
});

// 产品---游戏产品
Route::group('product/game', function () {
    Route::get('list', 'app\controller\GameProduct@list');
    Route::post('create', 'app\controller\GameProduct@create');
    Route::get('detail/:id', 'app\controller\GameProduct@detail');
    Route::put('update/:id', 'app\controller\GameProduct@update');
    Route::delete('delete/:id', 'app\controller\GameProduct@delete')->pattern(['id' => '\d+']);
    Route::post('import', 'app\controller\GameProduct@import');
    Route::get('export', 'app\controller\GameProduct@export');

    Route::get('failed-logs', 'app\controller\GameProduct@failedLogList');
    Route::post('retry-failed/:appId', 'app\controller\GameProduct@retryFailedLog');
    Route::delete('clean-fixed-logs', 'app\controller\GameProduct@cleanFixedLogs');
});


//首页
Route::group('home', function () {
    Route::get('list', 'Home/list');
    Route::get('export', 'Home/export');
});


//产品---平台配置
Route::group('platform/config', function () {
    Route::get('list', 'PlatformConfig/list');
    Route::post('create', 'PlatformConfig/create');
    Route::get('detail/:id', 'PlatformConfig/detail');
    Route::put('update/:id', 'PlatformConfig/update');
    Route::delete('delete/:id', 'PlatformConfig/delete');
    Route::post('import', 'PlatformConfig/import');
    Route::get('export', 'PlatformConfig/export');
});

